import request from '@/utils/request'

// 查询数据库备份任务列表
export function listBackupTask(query) {
  return request({
    url: '/system/backup/task/list',
    method: 'get',
    params: query
  })
}

// 查询数据库备份任务详细
export function getBackupTask(dbId) {
  return request({
    url: '/system/backup/task/' + dbId,
    method: 'get'
  })
}

// 修改数据库备份任务
export function updateBackupTask(data) {
  return request({
    url: '/system/backup/task',
    method: 'put',
    data: data
  })
}

// 启用/停用数据库备份任务
export function changeBackupTaskStatus(data) {
  return request({
    url: '/system/backup/task/changeStatus',
    method: 'put',
    data: data
  })
}

// 手动执行数据库备份
export function executeBackupTask(dbId) {
  return request({
    url: '/system/backup/task/execute/' + dbId,
    method: 'post'
  })
}

// 批量执行数据库备份
export function batchExecuteBackupTask(dbIds) {
  return request({
    url: '/system/backup/task/batchExecute',
    method: 'post',
    data: dbIds
  })
}

// 导出数据库备份任务
export function exportBackupTask(query) {
  return request({
    url: '/system/backup/task/export',
    method: 'post',
    params: query
  })
}

// 删除数据库备份任务
export function delBackupTask(dbIds) {
  return request({
    url: '/system/backup/task/' + dbIds,
    method: 'delete'
  })
}
